package app

import (
	"gitee.com/krio/ginc/example/core/lib/conf"
	loggerLib "gitee.com/krio/ginc/example/core/lib/logger"
	"gitee.com/krio/ginc/example/core/lib/mysql"
	redisLib "gitee.com/krio/ginc/example/core/lib/redis"
	ssoLib "gitee.com/krio/ginc/example/core/lib/sso"
	apiCore "gitee.com/krio/ginc/example/router/serve/api/core"
	rpcCore "gitee.com/krio/ginc/example/router/serve/rpc/core"
	"gitee.com/krio/ginc/example/util/cmdprint"
)

func Run() {
	// 配置
	conf.InitConfig()
	// 日志
	loggerLib.InitLogger()
	// mysql
	err := mysql.InitMysql()
	if err != nil {
		cmdprint.CmdFatal(err.Error())
		return
	}
	// redis
	redisLib.InitRedis()
	// 单点登录
	err = ssoLib.InitSSO()
	if err != nil {
		cmdprint.CmdFatal(err.Error())
		return
	}
	// rpc
	rpcCore.InitGrpcConn()
	// 启动api服务
	apiCore.StartApiServer()
}
